package com.svms.save.vo;

import java.util.ArrayList;
import java.util.List;

/**
 * 
* <p>Title: 分页对象</p>  
* <p>Description: </p>  
* @author xuyang
* @date 2019年7月1日
 */
public class Page<T> {
	/**
	 * 每页显示多少条数据
	 */
	private int pageSize = 10;
	/**
	 * 当前页数
	 */
	private int currentPageNo = 1;
	/**
	 *数据总数
	 */
	private long totail = 0;
	/**
	 * 数据
	 */
	private List<T> result = new ArrayList<T>();
	/**
	 * 每页显示多少条数据
	 */
	public int getPageSize() {
		// TODO Auto-generated method stub
		return this.pageSize;
	}

	public int getCurrentPageNo() {
		// TODO Auto-generated method stub
		return this.currentPageNo;
	}

	public List<T> getResult() {
		return result;
	}

	public void setResult(List<T> result) {
		this.result = result;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public void setCurrentPageNo(int currentPageNo) {
		this.currentPageNo = currentPageNo;
	}

	public long getTotail() {
		return totail;
	}

	public void setTotail(long totail) {
		this.totail = totail;
	}
	/**
	 * 
	 * <p>Title: 获取分页索引</p>  
	 */
	public int getOffset() {
		int offset =  (this.currentPageNo - 1) * this.pageSize;
		if(offset < 0) {
			offset = 0;
		}
		return offset;
	}
}
